From 30ce2a9295a53f989897497df0c195dc597b00d6 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Fri, 14 Oct 2005 15:40:48 +0100 Subject: [PATCH] Store an opaque handle (tools uuid) in the domain structure within Xen. Refactor GETVCPUCONTEXT into an op of the same name plus a new op GETVCPUINFO. Move the cpumap and cpu info arrays from GETDOMAININFO and move into new GETVCPUINFO. Signed-off-by: Keir Fraser --- tools/libxc/xc_core.c | 17 +-- tools/libxc/xc_domain.c | 22 ++- tools/libxc/xc_private.c | 9 +- tools/libxc/xenctrl.h | 13 +- tools/python/xen/lowlevel/xc/xc.c | 64 +++++--- tools/python/xen/xend/XendDomainInfo.py | 3 +- tools/python/xen/xm/main.py | 4 +- tools/xenstat/libxenstat/src/xen-interface.c | 11 +- xen/arch/x86/setup.c | 3 + xen/common/dom0_ops.c | 145 +++++++++---------- xen/common/keyhandler.c | 8 +- xen/include/public/dom0_ops.h | 28 +++- xen/include/public/xen.h | 2 + xen/include/xen/sched.h | 3 + 14 files changed, 179 insertions(+), 153 deletions(-) diff --git a/tools/libxc/xc_core.c b/tools/libxc/xc_core.c index 7c24b0b0bf..4694c0fe2f 100644 --- a/tools/libxc/xc_core.c +++ b/tools/libxc/xc_core.c @@ -33,7 +33,7 @@ xc_domain_dumpcore(int xc_handle, unsigned long nr_pages; unsigned long *page_array; xc_dominfo_t info; - int i, j, vcpu_map_size, dump_fd; + int i, j, dump_fd; char *dump_mem, *dump_mem_start = NULL; struct xc_core_header header; vcpu_guest_context_t ctxt[MAX_VIRT_CPUS]; @@ -54,18 +54,9 @@ xc_domain_dumpcore(int xc_handle, goto error_out; } - vcpu_map_size = sizeof(info.vcpu_to_cpu) / sizeof(info.vcpu_to_cpu[0]); - - for (i = 0, j = 0; i < vcpu_map_size; i++) { - if (info.vcpu_to_cpu[i] == -1) { - continue; - } - if (xc_domain_get_vcpu_context(xc_handle, domid, i, &ctxt[j])) { - PERROR("Could not get all vcpu contexts for domain"); - goto error_out; - } - j++; - } + for (i = 0, j = 0; i < 32; i++) + if (xc_domain_get_vcpu_context(xc_handle, domid, i, &ctxt[j]) == 0) + j++; nr_pages = info.nr_pages; diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c index 2ce970962a..6404b3f307 100644 --- a/tools/libxc/xc_domain.c +++ b/tools/libxc/xc_domain.c @@ -11,6 +11,7 @@ int xc_domain_create(int xc_handle, uint32_t ssidref, + xen_domain_handle_t handle, uint32_t *pdomid) { int err; @@ -19,6 +20,7 @@ int xc_domain_create(int xc_handle, op.cmd = DOM0_CREATEDOMAIN; op.u.createdomain.domain = (domid_t)*pdomid; op.u.createdomain.ssidref = ssidref; + memcpy(op.u.createdomain.handle, handle, sizeof(xen_domain_handle_t)); if ( (err = do_dom0_op(xc_handle, &op)) != 0 ) return err; @@ -59,7 +61,7 @@ int xc_domain_destroy(int xc_handle, int xc_domain_pincpu(int xc_handle, uint32_t domid, int vcpu, - cpumap_t *cpumap) + cpumap_t cpumap) { dom0_op_t op; op.cmd = DOM0_PINCPUDOMAIN; @@ -112,10 +114,9 @@ int xc_domain_getinfo(int xc_handle, info->shared_info_frame = op.u.getdomaininfo.shared_info_frame; info->cpu_time = op.u.getdomaininfo.cpu_time; info->vcpus = op.u.getdomaininfo.n_vcpu; - memcpy(&info->vcpu_to_cpu, &op.u.getdomaininfo.vcpu_to_cpu, - sizeof(info->vcpu_to_cpu)); - memcpy(&info->cpumap, &op.u.getdomaininfo.cpumap, - sizeof(info->cpumap)); + + memcpy(info->handle, op.u.getdomaininfo.handle, + sizeof(xen_domain_handle_t)); next_domid = (uint16_t)op.u.getdomaininfo.domain + 1; info++; @@ -166,19 +167,14 @@ int xc_domain_get_vcpu_context(int xc_handle, op.u.getvcpucontext.vcpu = (uint16_t)vcpu; op.u.getvcpucontext.ctxt = ctxt; - if ( (ctxt != NULL) && - ((rc = mlock(ctxt, sizeof(*ctxt))) != 0) ) + if ( (rc = mlock(ctxt, sizeof(*ctxt))) != 0 ) return rc; rc = do_dom0_op(xc_handle, &op); - if ( ctxt != NULL ) - safe_munlock(ctxt, sizeof(*ctxt)); + safe_munlock(ctxt, sizeof(*ctxt)); - if ( rc > 0 ) - return -ESRCH; - else - return rc; + return rc; } diff --git a/tools/libxc/xc_private.c b/tools/libxc/xc_private.c index c5ebf3ee39..94cc947400 100644 --- a/tools/libxc/xc_private.c +++ b/tools/libxc/xc_private.c @@ -256,16 +256,15 @@ long long xc_domain_get_cpu_usage( int xc_handle, domid_t domid, int vcpu ) { dom0_op_t op; - op.cmd = DOM0_GETVCPUCONTEXT; - op.u.getvcpucontext.domain = (domid_t)domid; - op.u.getvcpucontext.vcpu = (uint16_t)vcpu; - op.u.getvcpucontext.ctxt = NULL; + op.cmd = DOM0_GETVCPUINFO; + op.u.getvcpuinfo.domain = (domid_t)domid; + op.u.getvcpuinfo.vcpu = (uint16_t)vcpu; if ( (do_dom0_op(xc_handle, &op) < 0) ) { PERROR("Could not get info on domain"); return -1; } - return op.u.getvcpucontext.cpu_time; + return op.u.getvcpuinfo.cpu_time; } diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h index 158269caf7..a5bfb62ac8 100644 --- a/tools/libxc/xenctrl.h +++ b/tools/libxc/xenctrl.h @@ -123,23 +123,23 @@ int xc_waitdomain_core( */ typedef struct { - uint32_t domid; - uint32_t ssidref; + uint32_t domid; + uint32_t ssidref; unsigned int dying:1, crashed:1, shutdown:1, paused:1, blocked:1, running:1; unsigned int shutdown_reason; /* only meaningful if shutdown==1 */ unsigned long nr_pages; unsigned long shared_info_frame; - uint64_t cpu_time; + uint64_t cpu_time; unsigned long max_memkb; unsigned int vcpus; - int32_t vcpu_to_cpu[MAX_VIRT_CPUS]; - cpumap_t cpumap[MAX_VIRT_CPUS]; + xen_domain_handle_t handle; } xc_dominfo_t; typedef dom0_getdomaininfo_t xc_domaininfo_t; int xc_domain_create(int xc_handle, uint32_t ssidref, + xen_domain_handle_t handle, uint32_t *pdomid); @@ -194,7 +194,8 @@ int xc_domain_destroy(int xc_handle, int xc_domain_pincpu(int xc_handle, uint32_t domid, int vcpu, - cpumap_t *cpumap); + cpumap_t cpumap); + /** * This function will return information about one or more domains. It is * designed to iterate over the list of domains. If a single domain is diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index 03f4ed2415..4108e1ff30 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -77,17 +77,41 @@ static PyObject *pyxc_domain_create(PyObject *self, { XcObject *xc = (XcObject *)self; - uint32_t dom = 0; - int ret; - uint32_t ssidref = 0x0; + uint32_t dom = 0; + int ret, i; + uint32_t ssidref = 0; + PyObject *pyhandle = NULL; + xen_domain_handle_t handle = { + 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, + 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef }; + + static char *kwd_list[] = { "dom", "ssidref", "handle", NULL }; + + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iiO", kwd_list, + &dom, &ssidref, &pyhandle)) + return NULL; - static char *kwd_list[] = { "dom", "ssidref", NULL }; + if ( pyhandle != NULL ) + { + if ( !PyList_Check(pyhandle) || + (PyList_Size(pyhandle) != sizeof(xen_domain_handle_t)) ) + { + out_exception: + errno = EINVAL; + PyErr_SetFromErrno(xc_error); + return NULL; + } - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|ii", kwd_list, - &dom, &ssidref)) - return NULL; + for ( i = 0; i < sizeof(xen_domain_handle_t); i++ ) + { + PyObject *p = PyList_GetItem(pyhandle, i); + if ( !PyInt_Check(p) ) + goto out_exception; + handle[i] = (uint8_t)PyInt_AsLong(p); + } + } - if ( (ret = xc_domain_create(xc->xc_handle, ssidref, &dom)) < 0 ) + if ( (ret = xc_domain_create(xc->xc_handle, ssidref, handle, &dom)) < 0 ) return PyErr_SetFromErrno(xc_error); return PyInt_FromLong(dom); @@ -181,7 +205,7 @@ static PyObject *pyxc_domain_pincpu(PyObject *self, uint32_t dom; int vcpu = 0; - cpumap_t cpumap = 0xFFFFFFFF; + cpumap_t cpumap = ~0ULL; static char *kwd_list[] = { "dom", "vcpu", "cpumap", NULL }; @@ -189,7 +213,7 @@ static PyObject *pyxc_domain_pincpu(PyObject *self, &dom, &vcpu, &cpumap) ) return NULL; - if ( xc_domain_pincpu(xc->xc_handle, dom, vcpu, &cpumap) != 0 ) + if ( xc_domain_pincpu(xc->xc_handle, dom, vcpu, cpumap) != 0 ) return PyErr_SetFromErrno(xc_error); Py_INCREF(zero); @@ -223,7 +247,7 @@ static PyObject *pyxc_domain_getinfo(PyObject *self, PyObject *kwds) { XcObject *xc = (XcObject *)self; - PyObject *list, *vcpu_list, *cpumap_list, *info_dict; + PyObject *list, *info_dict; uint32_t first_dom = 0; int max_doms = 1024, nr_doms, i, j; @@ -249,15 +273,9 @@ static PyObject *pyxc_domain_getinfo(PyObject *self, list = PyList_New(nr_doms); for ( i = 0 ; i < nr_doms; i++ ) { - vcpu_list = PyList_New(MAX_VIRT_CPUS); - cpumap_list = PyList_New(MAX_VIRT_CPUS); - for ( j = 0; j < MAX_VIRT_CPUS; j++ ) { - PyList_SetItem( vcpu_list, j, - Py_BuildValue("i", info[i].vcpu_to_cpu[j])); - PyList_SetItem( cpumap_list, j, - Py_BuildValue("i", info[i].cpumap[j])); - } - + PyObject *pyhandle = PyList_New(sizeof(xen_domain_handle_t)); + for ( j = 0; j < sizeof(xen_domain_handle_t); j++ ) + PyList_SetItem(pyhandle, j, PyInt_FromLong(info[i].handle[j])); info_dict = Py_BuildValue("{s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i" ",s:l,s:L,s:l,s:i,s:i}", "dom", info[i].domid, @@ -273,10 +291,8 @@ static PyObject *pyxc_domain_getinfo(PyObject *self, "maxmem_kb", info[i].max_memkb, "ssidref", info[i].ssidref, "shutdown_reason", info[i].shutdown_reason); - PyDict_SetItemString( info_dict, "vcpu_to_cpu", vcpu_list ); - PyDict_SetItemString( info_dict, "cpumap", cpumap_list ); - PyList_SetItem( list, i, info_dict); - + PyDict_SetItemString(info_dict, "handle", pyhandle); + PyList_SetItem(list, i, info_dict); } free(info); diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index 0ff379f7b9..612188db0c 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -1377,8 +1377,7 @@ class XendDomainInfo: # target = 0 means use all processors if target > 0: # count the number of online vcpus (cpu values in v2c map >= 0) - vcpu_to_cpu = dom_get(dom)['vcpu_to_cpu'] - vcpus_online = len(filter(lambda x: x >= 0, vcpu_to_cpu)) + vcpus_online = dom_get(dom)['vcpus'] log.debug("found %d vcpus online", vcpus_online) # disable any extra vcpus that are online over the requested target diff --git a/tools/python/xen/xm/main.py b/tools/python/xen/xm/main.py index 3df329c9ac..a3e35f993b 100644 --- a/tools/python/xen/xm/main.py +++ b/tools/python/xen/xm/main.py @@ -270,9 +270,9 @@ def parse_doms_info(info): vcpuinfo['dom'] = int(sxp.child_value(info, 'domid', '-1')) vcpuinfo['vcpu'] = int(count) vcpuinfo['cpu'] = int(cpu) - vcpuinfo['cpumap'] = int(cpumap[count])&mask + #vcpuinfo['cpumap'] = int(cpumap[count])&mask count = count + 1 - dominfo['vcpulist'].append(vcpuinfo) + #dominfo['vcpulist'].append(vcpuinfo) return dominfo def xm_brief_list(domsinfo): diff --git a/tools/xenstat/libxenstat/src/xen-interface.c b/tools/xenstat/libxenstat/src/xen-interface.c index 9358494d11..e0f9de7c07 100644 --- a/tools/xenstat/libxenstat/src/xen-interface.c +++ b/tools/xenstat/libxenstat/src/xen-interface.c @@ -178,16 +178,15 @@ long long xi_get_vcpu_usage(xi_handle *handle, unsigned int domain, unsigned int vcpu) { dom0_op_t op; - op.u.getvcpucontext.domain = domain; - op.u.getvcpucontext.vcpu = vcpu; - op.u.getvcpucontext.ctxt = NULL; + op.u.getvcpuinfo.domain = domain; + op.u.getvcpuinfo.vcpu = vcpu; - if (xi_make_dom0_op(handle, &op, DOM0_GETVCPUCONTEXT) < 0) { - perror("DOM0_GETVCPUCONTEXT Hypercall failed"); + if (xi_make_dom0_op(handle, &op, DOM0_GETVCPUINFO) < 0) { + perror("DOM0_GETVCPUINFO Hypercall failed"); return -1; } - return op.u.getvcpucontext.cpu_time; + return op.u.getvcpuinfo.cpu_time; } /* gets xen version information from hypervisor */ diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 5131250cbb..208142e119 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -420,6 +420,9 @@ void __init __start_xen(multiboot_info_t *mbi) nr_pages << (PAGE_SHIFT - 10)); total_pages = nr_pages; + /* Sanity check for unwanted bloat of dom0_op_t structure. */ + BUG_ON(sizeof(((dom0_op_t *)0)->u) != sizeof(((dom0_op_t *)0)->u.pad)); + init_frametable(); end_boot_allocator(); diff --git a/xen/common/dom0_ops.c b/xen/common/dom0_ops.c index 458255d3db..d1d2bfcefa 100644 --- a/xen/common/dom0_ops.c +++ b/xen/common/dom0_ops.c @@ -48,26 +48,20 @@ static void getdomaininfo(struct domain *d, dom0_getdomaininfo_t *info) info->domain = d->domain_id; - memset(&info->vcpu_to_cpu, -1, sizeof(info->vcpu_to_cpu)); - memset(&info->cpumap, 0, sizeof(info->cpumap)); - /* * - domain is marked as blocked only if all its vcpus are blocked * - domain is marked as running if any of its vcpus is running - * - only map vcpus that aren't down. Note, at some point we may - * wish to demux the -1 value to indicate down vs. not-ever-booted */ for_each_vcpu ( d, v ) { - /* only map vcpus that are up */ - if ( !(test_bit(_VCPUF_down, &v->vcpu_flags)) ) - info->vcpu_to_cpu[v->vcpu_id] = v->processor; - info->cpumap[v->vcpu_id] = v->cpumap; - if ( !(v->vcpu_flags & VCPUF_blocked) ) - flags &= ~DOMFLAGS_BLOCKED; - if ( v->vcpu_flags & VCPUF_running ) - flags |= DOMFLAGS_RUNNING; cpu_time += v->cpu_time; - vcpu_count++; + if ( !test_bit(_VCPUF_down, &v->vcpu_flags) ) + { + if ( !(v->vcpu_flags & VCPUF_blocked) ) + flags &= ~DOMFLAGS_BLOCKED; + if ( v->vcpu_flags & VCPUF_running ) + flags |= DOMFLAGS_RUNNING; + vcpu_count++; + } } info->cpu_time = cpu_time; @@ -87,6 +81,8 @@ static void getdomaininfo(struct domain *d, dom0_getdomaininfo_t *info) info->tot_pages = d->tot_pages; info->max_pages = d->max_pages; info->shared_info_frame = __pa(d->shared_info) >> PAGE_SHIFT; + + memcpy(info->handle, d->handle, sizeof(xen_domain_handle_t)); } long do_dom0_op(dom0_op_t *u_dom0_op) @@ -214,6 +210,9 @@ long do_dom0_op(dom0_op_t *u_dom0_op) if ( (d = do_createdomain(dom, pro)) == NULL ) break; + memcpy(d->handle, op->u.createdomain.handle, + sizeof(xen_domain_handle_t)); + ret = 0; op->u.createdomain.domain = d->domain_id; @@ -288,8 +287,6 @@ long do_dom0_op(dom0_op_t *u_dom0_op) domid_t dom = op->u.pincpudomain.domain; struct domain *d = find_domain_by_id(dom); struct vcpu *v; - cpumap_t cpumap; - if ( d == NULL ) { @@ -320,26 +317,17 @@ long do_dom0_op(dom0_op_t *u_dom0_op) break; } - if ( copy_from_user(&cpumap, op->u.pincpudomain.cpumap, - sizeof(cpumap)) ) - { - ret = -EFAULT; - put_domain(d); - break; - } - - /* update cpumap for this vcpu */ - v->cpumap = cpumap; + v->cpumap = op->u.pincpudomain.cpumap; - if ( cpumap == CPUMAP_RUNANYWHERE ) + if ( v->cpumap == CPUMAP_RUNANYWHERE ) { clear_bit(_VCPUF_cpu_pinned, &v->vcpu_flags); } else { /* pick a new cpu from the usable map */ - int new_cpu = (int)find_first_set_bit(cpumap) % num_online_cpus(); - + int new_cpu; + new_cpu = (int)find_first_set_bit(v->cpumap) % num_online_cpus(); vcpu_pause(v); vcpu_migrate_cpu(v, new_cpu); set_bit(_VCPUF_cpu_pinned, &v->vcpu_flags); @@ -394,6 +382,8 @@ long do_dom0_op(dom0_op_t *u_dom0_op) } break; + + case DOM0_GETDOMAININFOLIST: { struct domain *d; @@ -446,66 +436,73 @@ long do_dom0_op(dom0_op_t *u_dom0_op) struct vcpu_guest_context *c; struct domain *d; struct vcpu *v; - int i; - d = find_domain_by_id(op->u.getvcpucontext.domain); - if ( d == NULL ) - { - ret = -ESRCH; + ret = -ESRCH; + if ( (d = find_domain_by_id(op->u.getvcpucontext.domain)) == NULL ) break; - } + ret = -EINVAL; if ( op->u.getvcpucontext.vcpu >= MAX_VIRT_CPUS ) - { - ret = -EINVAL; - put_domain(d); - break; - } + goto getvcpucontext_out; - /* find first valid vcpu starting from request. */ - v = NULL; - for ( i = op->u.getvcpucontext.vcpu; i < MAX_VIRT_CPUS; i++ ) - { - v = d->vcpu[i]; - if ( v != NULL && !(test_bit(_VCPUF_down, &v->vcpu_flags)) ) - break; - } - - if ( v == NULL ) - { - ret = -ESRCH; - put_domain(d); - break; - } + ret = -ESRCH; + v = d->vcpu[op->u.getvcpucontext.vcpu]; + if ( (v == NULL) || test_bit(_VCPUF_down, &v->vcpu_flags) ) + goto getvcpucontext_out; - op->u.getvcpucontext.cpu_time = v->cpu_time; + ret = -ENOMEM; + if ( (c = xmalloc(struct vcpu_guest_context)) == NULL ) + goto getvcpucontext_out; - if ( op->u.getvcpucontext.ctxt != NULL ) - { - if ( (c = xmalloc(struct vcpu_guest_context)) == NULL ) - { - ret = -ENOMEM; - put_domain(d); - break; - } + if ( v != current ) + vcpu_pause(v); - if ( v != current ) - vcpu_pause(v); + arch_getdomaininfo_ctxt(v,c); + ret = 0; - arch_getdomaininfo_ctxt(v,c); + if ( v != current ) + vcpu_unpause(v); - if ( v != current ) - vcpu_unpause(v); + if ( copy_to_user(op->u.getvcpucontext.ctxt, c, sizeof(*c)) ) + ret = -EFAULT; - if ( copy_to_user(op->u.getvcpucontext.ctxt, c, sizeof(*c)) ) - ret = -EINVAL; + xfree(c); - xfree(c); - } + if ( copy_to_user(u_dom0_op, op, sizeof(*op)) ) + ret = -EFAULT; + + getvcpucontext_out: + put_domain(d); + } + break; + + case DOM0_GETVCPUINFO: + { + struct domain *d; + struct vcpu *v; + + ret = -ESRCH; + if ( (d = find_domain_by_id(op->u.getvcpuinfo.domain)) == NULL ) + break; + + ret = -EINVAL; + if ( op->u.getvcpuinfo.vcpu >= MAX_VIRT_CPUS ) + goto getvcpuinfo_out; + + ret = -ESRCH; + v = d->vcpu[op->u.getvcpuinfo.vcpu]; + if ( (v == NULL) || test_bit(_VCPUF_down, &v->vcpu_flags) ) + goto getvcpuinfo_out; + + op->u.getvcpuinfo.cpu_time = v->cpu_time; + op->u.getvcpuinfo.cpu = v->processor; + op->u.getvcpuinfo.cpumap = v->cpumap; + ret = 0; if ( copy_to_user(u_dom0_op, op, sizeof(*op)) ) - ret = -EINVAL; + ret = -EFAULT; + getvcpuinfo_out: put_domain(d); } break; diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c index f7136addda..0f1bbb9872 100644 --- a/xen/common/keyhandler.c +++ b/xen/common/keyhandler.c @@ -99,7 +99,7 @@ static void halt_machine(unsigned char key, struct cpu_user_regs *regs) static void do_task_queues(unsigned char key) { struct domain *d; - struct vcpu *v; + struct vcpu *v; s_time_t now = NOW(); printk("'%c' pressed -> dumping task queues (now=0x%X:%08X)\n", key, @@ -112,6 +112,12 @@ static void do_task_queues(unsigned char key) printk("Xen: DOM %u, flags=%lx refcnt=%d nr_pages=%d " "xenheap_pages=%d\n", d->domain_id, d->domain_flags, atomic_read(&d->refcnt), d->tot_pages, d->xenheap_pages); + printk(" handle=%02x%02x%02x%02x-%02x%02x%02x%02x-" + "%02x%02x%02x%02x-%02x%02x%02x%02x\n", + d->handle[ 0], d->handle[ 1], d->handle[ 2], d->handle[ 3], + d->handle[ 4], d->handle[ 5], d->handle[ 6], d->handle[ 7], + d->handle[ 8], d->handle[ 9], d->handle[10], d->handle[11], + d->handle[12], d->handle[13], d->handle[14], d->handle[15]); dump_pageframe_info(d); diff --git a/xen/include/public/dom0_ops.h b/xen/include/public/dom0_ops.h index 3d6a524781..528f9afc69 100644 --- a/xen/include/public/dom0_ops.h +++ b/xen/include/public/dom0_ops.h @@ -45,6 +45,7 @@ typedef struct sched_adjdom_cmd dom0_adjustdom_t; typedef struct { /* IN parameters */ uint32_t ssidref; + xen_domain_handle_t handle; /* IN/OUT parameters. */ /* Identifier for new domain (auto-allocate if zero is specified). */ domid_t domain; @@ -88,9 +89,8 @@ typedef struct { unsigned long shared_info_frame; /* MFN of shared_info struct */ uint64_t cpu_time; uint32_t n_vcpu; - int32_t vcpu_to_cpu[MAX_VIRT_CPUS]; /* current mapping */ - cpumap_t cpumap[MAX_VIRT_CPUS]; /* allowable mapping */ uint32_t ssidref; + xen_domain_handle_t handle; } dom0_getdomaininfo_t; #define DOM0_SETDOMAININFO 13 @@ -180,9 +180,9 @@ typedef struct { #define DOM0_PINCPUDOMAIN 20 typedef struct { /* IN variables. */ - domid_t domain; - uint16_t vcpu; - cpumap_t *cpumap; + domid_t domain; + uint16_t vcpu; + cpumap_t cpumap; } dom0_pincpudomain_t; /* Get trace buffers machine base address */ @@ -352,12 +352,24 @@ typedef struct { #define DOM0_GETVCPUCONTEXT 37 typedef struct { + /* IN variables. */ domid_t domain; /* domain to be affected */ uint16_t vcpu; /* vcpu # */ - vcpu_guest_context_t *ctxt; /* NB. IN/OUT variable. */ - uint64_t cpu_time; + /* OUT variables. */ + vcpu_guest_context_t *ctxt; } dom0_getvcpucontext_t; +#define DOM0_GETVCPUINFO 43 +typedef struct { + /* IN variables. */ + domid_t domain; /* domain to be affected */ + uint16_t vcpu; /* vcpu # */ + /* OUT variables. */ + uint64_t cpu_time; + uint32_t cpu; /* current mapping */ + cpumap_t cpumap; /* allowable mapping */ +} dom0_getvcpuinfo_t; + #define DOM0_GETDOMAININFOLIST 38 typedef struct { /* IN variables. */ @@ -426,10 +438,12 @@ typedef struct { dom0_microcode_t microcode; dom0_ioport_permission_t ioport_permission; dom0_getvcpucontext_t getvcpucontext; + dom0_getvcpuinfo_t getvcpuinfo; dom0_getdomaininfolist_t getdomaininfolist; dom0_platform_quirk_t platform_quirk; dom0_physical_memory_map_t physical_memory_map; dom0_max_vcpus_t max_vcpus; + uint8_t pad[128]; } u; } dom0_op_t; diff --git a/xen/include/public/xen.h b/xen/include/public/xen.h index d6a3098f2f..c0111b5027 100644 --- a/xen/include/public/xen.h +++ b/xen/include/public/xen.h @@ -437,6 +437,8 @@ extern shared_info_t *HYPERVISOR_shared_info; typedef uint64_t cpumap_t; +typedef uint8_t xen_domain_handle_t[16]; + #endif /* !__ASSEMBLY__ */ #endif /* __XEN_PUBLIC_XEN_H__ */ diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 6f8a43d384..4250205268 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -139,6 +139,9 @@ struct domain struct arch_domain arch; void *ssid; /* sHype security subject identifier */ + + /* Control-plane tools handle for this domain. */ + xen_domain_handle_t handle; }; struct domain_setup_info -- 2.30.2